﻿@using MvcGlobalisationSupport
@using TrucksDir.Resources

<script type="text/javascript">
// Copyright 2006-2007 javascript-array.com

var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id) {
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 
</script>

<ul id="sddm">
    <li>
    
       @switch (Culture)
       {
           case CultureManager.SpanishCulture: <span class="lanEs" onmouseover="mopen('m1')" onmouseout="mclosetime()"><a href="#" >@Common.SpanishLangName </a></span> break;
           case CultureManager.EngilshCulture: <span class="lanEn" onmouseover="mopen('m1')" onmouseout="mclosetime()"><a href="#" >@Common.EnglishLangName</a></span> break;
           default: break;
       }
   
    @*<a href="#" onmouseover="mopen('m1')" onmouseout="mclosetime()">Language</a>*@
        <div id="m1" 
            onmouseover="mcancelclosetime()" 
            onmouseout="mclosetime()">
            @if (Culture != CultureManager.EngilshCulture)
            {
                <span class="lanEn">@Html.GlobalisedRouteLink(Common.EnglishLangName, Common.EnglishLangKey, ViewContext.RouteData)</span>
            }             
            @if (Culture != CultureManager.SpanishCulture)
            {
                <span class="lanEs">@Html.GlobalisedRouteLink(Common.SpanishLangName, Common.SpanishLangKey, ViewContext.RouteData)</span>
            }
        </div>
    </li>
</ul>
<div style="clear:both"></div>